﻿// --------------------------------------------------------------------------------------
// <copyright file="PagingInfoModel.cs" company="NGroup">
// Copyright (c) NGroup. All rights reserved.
// </copyright>
// --------------------------------------------------------------------------------------
// <history>
//     <change who="Bui Thanh Nam" date="2013.12.15">Create</change>
// </history>
// --------------------------------------------------------------------------------------

namespace NGroup.VTL.Models
{
    using System.Collections.Generic;
    using NGroup.VTL.Core.Const;

    public class PagingInfoModel
    {
        public PagingInfoModel()
        {
            PageSize = GeneralConfiguration.PageSize;
            PageSizeList = GeneralConfiguration.PageSizeCollection;
            CurrentPage = 1;
            PageIndex = 1;
            TotalPages = 1;
            TotalRows = 1;
        }

        public int CurrentPage { get; set; }

        public int PageIndex { get; set; }

        public int PageSize { get; set; }

        public int TotalPages { get; set; }

        public int TotalRows { get; set; }

        public Dictionary<int, string> PageSizeList { get; set; }

        public void UpdateValues(int totalRows)
        {
            TotalRows = totalRows;
            TotalPages = (totalRows / PageSize) + ((totalRows % PageSize) > 0 ? 1 : 0);
        }
    }
}
